﻿namespace Amber.Arch.Catty
{
    public interface IFoo
    {
        string CreateFoo();
    }
    public interface IBar { }
    public interface IBaz { }
    public interface IQux { }
    public interface IFoobar<T1, T2> { }

    public class Base : IDisposable
    {
        public Base() => Console.WriteLine($"在{DateTime.Now:HH:mm:ss:fffff}，{GetType().Name}的实例已被创建。");

        public void Dispose() => Console.WriteLine($"{GetType().Name} 的实例已被销毁。");
    }

    [MapTo(typeof(IFoo), LifeTime.Root)]
    public class Foo : Base, IFoo
    {
        public string CreateFoo()
        {
            return "创建了Foo实例";
        }
    }
    public class Bar : Base, IBar { }
    public class Baz : Base, IBaz { }
    [MapTo(typeof(IQux), LifeTime.Root)]
    public class Qux : Base, IQux { }
    class FooBar<T1, T2> : IFoobar<T1, T2>
    {
        public T1 Foo { get; }
        public T2 Bar { get; }
        public FooBar(T1 foo, T2 bar)
        {
            Foo = foo;
            Bar = bar;
        }
    }
}
